<%@ page contentType="application/pdf" %><%@ page import="java.util.*" %><%@ page import="com.ionglobal.misc.*" %><%@ page import="com.ionglobal.misc.*" %><%@ page import="com.dhec.ggs.*"%><%@ page import="java.io.*"%><%@ include file="/inc/init_include.jsp" %><%@ page import="com.ionglobal.lib.*" %><%
Sysop sysop = new Sysop();
if (session.getAttribute("sysop")!=null) {
	sysop = (Sysop) session.getAttribute("sysop");
	System.out.println("sysop!");
} else {
	return;
}
		//禁止缓存
		response.setHeader("Cache-Control","no-cache");
		response.setHeader("Cache-Control","no-store");
		response.setHeader("Expires","0");
		String link = Request.getString("link");
		int fileId = Request.getInt("fileId", 0);
		int dcn = Request.getInt("dcn", 0);
		int hes = Request.getInt("hes", 0);
		String language = Request.getString("L");
		if(dcn>0){
			DesignChangeApp decApp=new DesignChangeApp();
			DesignChange dec=new DesignChange();
			dec=decApp.getDesignChange(dbi,dcn);
			link=dec.getFile();
		}
		if(hes>0){
			HesDataApp hesApp = new HesDataApp();
			HesData hesData = hesApp.getHesData(dbi, hes);
			if(hesData!=null)
				if(language.equals("E"))
					link = hesData.getFile();
				else if(language.equals("J"))
					link = hesData.getJFile();	
		}
		if(fileId>0){
			AttachmentApp attApp = new AttachmentApp();
			Attachment att = attApp.getAttachment(dbi, fileId);
			if(att!=null)
				link = att.getFilePath();	
		}
		String p = Request.getString("p");
		boolean canPrint = p.equals("1");
		
		File file = new File(link);
			java.io.OutputStream out1 = response.getOutputStream(); 
			java.io.InputStream in = new java.io.FileInputStream(file);
			BufferedOutputStream bo = new BufferedOutputStream(out1); 
			BufferedInputStream bi = new BufferedInputStream(in); 
			
			int bytesRead = 0; 
			byte[] buffer = new byte[8192]; 
			while ((bytesRead = bi.read(buffer, 0, 8192)) != -1) { 
				bo.write(buffer, 0, bytesRead); 
			} 
			bo.flush(); 
			bi.close(); 
			bo.close(); 
			in.close(); 
			out1.close(); 
%><%@ include file="/inc/init_free.jsp" %>